<?php 
	/* 
		Model untuk halaman admin menu
	*/
	Class Menu_model extends CI_Model {
	
		function __construct(){
        parent::__construct();
		}
		
		// Inisialisasi nama tabel siswa
		var $table = 'menuCategory';
	
		/* 
			Menampilkan seluruh data
		*/
		function get_view(){
			$sql="SELECT menu.*,menuCategory.* FROM menu,menuCategory WHERE menu.mcId=menuCategory.mcId ORDER BY menu.menuViewsort";
			$query = $this->db->query($sql);
			return $query;
		}

		function categoryindex(){
			$sql="SELECT * FROM menuCategory ORDER BY	mcViewsort";
			$query = $this->db->query($sql);
			return $query;
		}
		/* 
			Menyimpan data baru
		*/
		function addcategory($category){
			$this->db->insert($this->table, $category);
		}

		/* 
			Meng-update data yang dipilih
		*/
		function getcategorywithid($id) {
			$sql="SELECT * FROM menucategory WHERE mcId='$id'";
			$query=$this->db->query($sql);
			return $query;
		}
		
		function editcategoryproccess($id,$catergory) {
			$this->db->update('menucategory', $catergory, "mcId='$id'");
		}
		/* 
			Menghapus data yang di pilih
		*/
		function delete_data() {
		
		}
		
		
	}
?>